package com.zx.erp.repo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zx.erp.repo.bean.CkWarehouse;
import com.zx.erp.repo.mapper.CkWarehouseDao;
import com.zx.erp.repo.service.CkWarehouseBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

/**
 * 出库biz接口 实现类
 *
 * @author Jerry
 */
@Service
public class CkWarehouseBizImpl implements CkWarehouseBiz {
    @Autowired
    private CkWarehouseDao ckdao;

    @Override
    public PageInfo<CkWarehouse> findAllCk(String cName, CkWarehouse ckWarehouse, Integer pageno, Integer pagesize) {
        PageHelper.startPage(pageno, pagesize);
        List<CkWarehouse> allCk = ckdao.findAllCk(cName, ckWarehouse);
        PageInfo<CkWarehouse> pin = new PageInfo<CkWarehouse>(allCk);
        return pin;
    }

    @Override
    public CkWarehouse findByCkId(Integer id) {
        return ckdao.findByCkId(id);
    }

    @Override
    public Boolean saveCk(CkWarehouse ckWarehouse) {
        return ckdao.insertCk(ckWarehouse);
    }

    @Override
    public Boolean updateCk(CkWarehouse ckWarehouse) {
        return ckdao.updateCk(ckWarehouse);
    }

    @Override
    public PageInfo<CkWarehouse> findPageAllFZ(List<Integer> widList1,List<Integer> widList2, Date dateMin, Date dateMax, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<CkWarehouse> pageInfo = new PageInfo<CkWarehouse>(ckdao.selectAllFZ(widList1,widList2, dateMin, dateMax));
        return pageInfo;
    }

    @Override
    public PageInfo<CkWarehouse> findPageByFZ(Integer wid,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<CkWarehouse> pageInfo = new PageInfo<CkWarehouse>(ckdao.selectByFZ(wid));
        return pageInfo;
    }


}
